package com.zl.smartmall.library.po;

import java.util.ArrayList;
import java.util.List;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

public class OrdersProductInfo {
	
	private int shopId;
	private	int productId;
	private int buyNum;
	private double tagPrice;
	private double salePrice;
	private String productTitle;
	private String productName;
	private String icon;
	
	public int getShopId() {
		return shopId;
	}


	public void setShopId(int shopId) {
		this.shopId = shopId;
	}


	public int getProductId() {
		return productId;
	}


	public void setProductId(int productId) {
		this.productId = productId;
	}


	public int getBuyNum() {
		return buyNum;
	}


	public void setBuyNum(int buyNum) {
		this.buyNum = buyNum;
	}


	public double getTagPrice() {
		return tagPrice;
	}


	public void setTagPrice(double tagPrice) {
		this.tagPrice = tagPrice;
	}


	public double getSalePrice() {
		return salePrice;
	}


	public void setSalePrice(double salePrice) {
		this.salePrice = salePrice;
	}


	public String getProductTitle() {
		return productTitle;
	}


	public void setProductTitle(String productTitle) {
		this.productTitle = productTitle;
	}


	public String getProductName() {
		return productName;
	}


	public void setProductName(String productName) {
		this.productName = productName;
	}


	public String getIcon() {
		return icon;
	}


	public void setIcon(String icon) {
		this.icon = icon;
	}


	public static List<OrdersProductInfo> parse(JSONArray jsonArray) throws JSONException {
		List<OrdersProductInfo> shoppingInfoList = new ArrayList<OrdersProductInfo>();
		for(int j = 0; jsonArray != null && j < jsonArray.length();j++){
			OrdersProductInfo cartInfo = new OrdersProductInfo();
			JSONObject productInfo = jsonArray.getJSONObject(j);
			cartInfo.buyNum = productInfo.getInt("product_num");
			cartInfo.tagPrice = productInfo.getDouble("price");
			cartInfo.salePrice = productInfo.getDouble("sale_price");
			cartInfo.shopId = productInfo.getInt("shop_id");
			cartInfo.productTitle = productInfo.getString("product_title");
			cartInfo.productId = productInfo.getInt("product_id");
			cartInfo.productName = productInfo.getString("product_name");
			cartInfo.icon = productInfo.getString("title_pic");
			shoppingInfoList.add(cartInfo);
		}
		return shoppingInfoList;
	}
}
